package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.Menu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
 *  @author 雨安
 *  类名： MenuMapper
 *  创建时间：2024/3/30
 */
@Repository
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("select\n" +
            "    DISTINCT m.perms\n" +
            "    from sys_user_role urole\n" +
            "    left join sys_role role on urole.role_id = role.id\n" +
            "    left join sys_role_menu rm on rm.role_id = urole.role_id\n" +
            "    left join sys_menu m on m.id = rm.menu_id\n" +
            "    where user_id = #{uid} and role.status = 0 and m.status = 0")
    List<String> selectPermByUserId(@Param("uid") Long uid);


}
